package com.itheima.model.book.vos;


import com.itheima.model.book.pojos.Category;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 带子节点的分类树（用于树形结构）
 */
@Data
public class CategoryTreeVo implements Serializable {
    private static final long serialVersionUID = 1L;
    //主键
    private Integer id;
    //分类名称
    private String name;
    //父节点Id
    private Integer parentId;
    //优先级顺序
    private Integer sort;
    //子分类列表
    private List<CategoryTreeVo> children;

    public CategoryTreeVo(Category category) {
        this.id = category.getId();
        this.name = category.getName();
        this.parentId = category.getParentId();
        this.sort = category.getSort();
    }
}